/*
 * Copyright(c) 2020-2100 万达信息股份有限公司 版权所有
 * WONDERS INFORMATION CO., LTD. ALL RIGHTS RESERVED.
 */

package com.wondersgroup.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 编码方式实现路由（不推荐使用）
 * @author: huym
 * @version: 1.0
 * @date: 2020/11/20
 */
//@Configuration
public class GatewayConfig {
    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder builder){
        return builder.routes()
                .route("user_route", r -> r.path("/user/**").uri("http://localhost:9999"))
                .route("product_route", r->r.path("/product/**").uri("http://localhost:9998"))
                .build();
    }
}
